package cn.itcast.nems.studentrecord.dao.mapper;

import cn.itcast.nems.employee.dao.bean.EmployeeGroupBean;
import cn.itcast.nems.studentrecord.dao.dataobject.JournalRenewalLineDO;
import cn.itcast.nems.studentrecord.dao.entity.JournalRenewalLine;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface JournalRenewalLineMapper extends BaseMapper<JournalRenewalLine> {

    List<JournalRenewalLineDO> findListByRenewalId(@Param("renewalId") String renewalId);

    @InterceptorIgnore(tenantLine = "true")
    IPage<JournalRenewalLineDO> findPageListByRenewalIdAndCondition(Page<JournalRenewalLineDO> page, @Param("lineDO") JournalRenewalLineDO lineDO, @Param("employeeGroups") List<EmployeeGroupBean> employeeGroups);


    /**
     * 查询就业班学籍ID
     *
     * @param id 凭单行ID
     * @return 就业班学籍ID
     */
    String selectJobStudentRecordId(@Param("id") String id);

    /**
     * 查询就业班对应的凭单行ID
     *
     * @param studentRecordId 就业班学籍ID
     * @return 凭单行ID
     */
    String selectLineIdByJobStudentRecordId(@Param("studentRecordId") String studentRecordId);

    /**
     * 根据订单ID查询凭单行ID
     *
     * @param orderId 订单ID（就业班订单）
     * @return 凭单行ID
     */
    String selectLineIdByOrderId(@Param("orderId") String orderId);

    /**
     * 修改凭单行状态
     *
     * @param id         凭单行ID
     * @param state      状态
     * @param modifiedBy 修改人
     */
    void updateState(@Param("id") String id, @Param("state") String state, @Param("modifiedBy") String modifiedBy);
}
